Skip to main content

SetLabel

Sets the label attribute to the current container.

Syntax

expression.SetLabel(sLabel);

expression - A variable that represents a ApiBlockLvlSdt class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sLabelRequiredstringThe label which will be added to the current container. Can be a positive or negative integer from -2147483647 to 2147483647.

Returns

This method doesn't return any data.

Example

This example sets the label attribute to the container.

let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control with a label set to it.");
blockLvlSdt.SetLabel("2147483647");
doc.AddElement(0, blockLvlSdt);
let label = blockLvlSdt.GetLabel();
let paragraph = doc.GetElement(1);
paragraph.AddText("Label: " + label);